Disconnect signal handlers
authorMatthias Clasen <mclasen@redhat.com>
Tue, 10 Dec 2013 23:21:58 +0000 (18:21 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 10 Dec 2013 23:21:58 +0000 (18:21 -0500)
We connect to notify::title on app-provided titlebars, but
we forgot to disconnect the signal handler when unsetting
the titlebar.

gtk/gtkwindow.c

index e1aea9c85806e12a40f5c322deb8c76406af4619..f1bc2f4e6d653fc8c3d0111f92fca2811879e837 100644 (file)
@@ -558,6 +558,9 @@ static void gtk_window_buildable_custom_finished (GtkBuildable  *buildable,
 
 static void ensure_state_flag_backdrop (GtkWidget *widget);
 static void unset_titlebar (GtkWindow *window);
+static void on_titlebar_title_notify (GtkHeaderBar *titlebar,
+                                      GParamSpec   *pspec,
+                                      GtkWindow    *self);
 
 G_DEFINE_TYPE_WITH_CODE (GtkWindow, gtk_window, GTK_TYPE_BIN,
                          G_ADD_PRIVATE (GtkWindow)
@@ -3472,6 +3475,11 @@ unset_titlebar (GtkWindow *window)
 {
   GtkWindowPrivate *priv = window->priv;
 
+  if (priv->titlebar != NULL)
+    g_signal_handlers_disconnect_by_func (priv->titlebar,
+                                          on_titlebar_title_notify,
+                                          window);
+
   if (priv->title_box != NULL)
     {
       gtk_widget_unparent (priv->title_box);
@@ -3546,8 +3554,8 @@ gdk_window_enable_csd (GtkWindow *window)
 
 static void
 on_titlebar_title_notify (GtkHeaderBar *titlebar,
-                          GParamSpec *pspec,
-                          GtkWindow *self)
+                          GParamSpec   *pspec,
+                          GtkWindow    *self)
 {
   gtk_window_set_title_internal (self, gtk_header_bar_get_title (titlebar),
                                  FALSE);